package com.ljf.tijian.service;

import com.ljf.tijian.ApiResponse;
import com.ljf.tijian.mapper.AnswerMapper;
import com.ljf.tijian.mapper.QuestionaireMapper;
import com.ljf.tijian.pojo.Answer;
import com.ljf.tijian.pojo.Questionaire;
import com.ljf.tijian.service.Impl.QuestionaireServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionService implements QuestionaireServiceImpl {

    @Autowired
    QuestionaireMapper questionaireMapper;

    @Autowired
    AnswerMapper answerMapper;

    @Override
    public ApiResponse getQuestionaire() {
        List<Questionaire> questionaires = questionaireMapper.selectQuestion();
        return new ApiResponse(200,"SUCCESS",questionaires);
    }

    @Override
    public ApiResponse inputAnswer(List<Answer> list) {
        answerMapper.batchInsert(list);
        return new ApiResponse(200,"SUCCESS");
    }


}

